from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome()
driver.get('http://192.168.20.244/ecshop/admin/privilege.php?act=login')
driver.maximize_window()
driver.find_element(By.NAME, 'username').send_keys('caichang')
driver.find_element(By.NAME, 'password').send_keys('caichang1')
driver.find_element(By.XPATH, '//*[@id="tijiao"]').click()

driver.switch_to.frame('menu-frame')
driver.find_element(By.XPATH, '//*[@id="menu-ul"]/li[2]/ul/li[2]/a').click()
driver.switch_to.default_content()

driver.switch_to.frame('main-frame')
driver.find_element(By.NAME, 'goods_name').send_keys('你好坏哦！我好喜欢。')
# Select(driver.find_element(By.NAME, 'cat_id')).select_by_index(8)  # 下拉框选择   先导Select包
Select(driver.find_element(By.NAME,'cat_id')).select_by_value('12')   # 下拉框选择  先导Select包  value定位

driver.find_element(By.XPATH, '//*[@id="tabbody-div"]/form/div/input[2]').click()
Select(driver.find_element(By.NAME,'theForm')).select_by_visible_text('#FF00FE')
# Select(driver.find_element(By.NAME,'cat_id')).select_by_value('19')
Select().s